home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / ada / gnat1792.zip / gnat179b / t-adainc / a-calcon.adb < prev    next >
Text File  |  1994-05-19  |  3KB  |  68 lines

  1. ------------------------------------------------------------------------------
  2. --                                                                          --
  3. --                 GNU ADA RUNTIME LIBRARY (GNARL) COMPONENTS               --
  4. --                                                                          --
  5. --                     A D A . C A L E N D A R . C O N V                    --
  6. --                                                                          --
  7. --                                  B o d y                                 --
  8. --                                                                          --
  9. --                             $Revision: 1.4 $                             --
  10. --                                                                          --
  11. --           Copyright (c) 1991,1992,1993, FSU, All Rights Reserved         --
  12. --                                                                          --
  13. --  GNARL is free software; you can redistribute it and/or modify it  under --
  14. --  terms  of  the  GNU  Library General Public License as published by the --
  15. --  Free Software Foundation;  either version 2, or (at  your  option)  any --
  16. --  later  version.   GNARL is distributed in the hope that it will be use- --
  17. --  ful, but but WITHOUT ANY WARRANTY; without even the implied warranty of --
  18. --  MERCHANTABILITY  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Gen- --
  19. --  eral Library Public License for more details.  You should have received --
  20. --  a  copy of the GNU Library General Public License along with GNARL; see --
  21. --  file COPYING. If not, write to the Free Software Foundation,  675  Mass --
  22. --  Ave, Cambridge, MA 02139, USA.                                          --
  23. --                                                                          --
  24. ------------------------------------------------------------------------------
  25.  
  26. package body Ada.Calendar.Conv is
  27.  
  28.    -----------------------
  29.    -- Time_To_Stimespec --
  30.    -----------------------
  31.  
  32.    function Time_To_Stimespec
  33.      (T    : Ada.Calendar.Time)
  34.       return System.Task_Clock.Stimespec
  35.    is
  36.    begin
  37.       return System.Task_Clock.Duration_To_Stimespec (T.Val);
  38.  
  39.    exception
  40.       --  Notice that the renage of Calendar.Time is not the same as
  41.       --  the range for Stimespec
  42.  
  43.       when others =>
  44.          raise Constraint_Error;
  45.  
  46.    end Time_To_Stimespec;
  47.  
  48.    -----------------------
  49.    -- Stimespec_To_Time --
  50.    -----------------------
  51.  
  52.    function Stimespec_To_Time
  53.      (T    : System.Task_Clock.Stimespec)
  54.       return Ada.Calendar.Time
  55.    is
  56.    begin
  57.       return (Val => System.Task_Clock.Stimespec_To_Duration (T));
  58.  
  59.    exception
  60.       --  Notice that the renage of Calendar.Time is not the same as
  61.       --  the range for Stimespec
  62.  
  63.       when others =>
  64.          raise Constraint_Error;
  65.    end Stimespec_To_Time;
  66.  
  67. end Ada.Calendar.Conv;
  68.